<template>
  <div class="search-tips">
    <div class="tip-item" v-for="(item, index) in data" :key="index">
      <div class="tips">
        <div class="name">{{ item.tips }}</div>
        <div class="el-icon-close" @click="setData(item.names)">关闭</div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref, defineProps, defineEmits, useAttrs } from 'vue';

const props = defineProps(["data"])
const emits = defineEmits(['setData']);

const setData = (names) => {
  emits("setData", names)
}


</script>
<style lang="scss" scoped>
.search-tips {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;

  .tip-item {
    min-width: 20px;
    max-width: 300px;
    text-align: center;
    line-height: 36px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #4e5969;

    .tips {
      padding: 0 12px;
      border: 1px solid #f2f3f5;
      display: flex;
      height: 36px;
      justify-content: center;
      align-items: center;
      border-radius: 8px;
      font-size: 12px;
      cursor: pointer;

      .name {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }
    }
  }
}
</style>
